package com.mjh.zhujianju.enums;

import java.util.Arrays;
import java.util.List;

/**
 * @author liuyang
 * @Description: 党建要闻枚举
 * @date 2018/8/15 0:05
 */
public enum BuildingNewsEnum {

    TYPE_POLICY("1","政策法规"),
    TYPE_COMPETITION("2","反腐倡廉"),
    TYPE_NEWS("3","管理要闻");

    private String code;
    private String name;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    BuildingNewsEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static BuildingNewsEnum[] getEnums(){
        return BuildingNewsEnum.values();
    }

    public static String getName(String code){
        if(code == null){
            return null;
        }

        for (BuildingNewsEnum buildingNewsEnum : BuildingNewsEnum.values()){
            if(code.equals(buildingNewsEnum.getCode())){
                return buildingNewsEnum.getName();
            }
        }

        return null;
    }
}
